package jaran.Tomxk.reflect;

import org.apache.commons.lang3.RandomStringUtils;

import java.lang.reflect.Method;

public class appTomxk {
    public static void main(String[] args) throws Exception{
        String s =RandomStringUtils.randomAlphabetic(6);
        System.out.println(s);
        User u = new User();
        u.setName("Tomxk");
        System.out.println(u.getName());
        u.setAge(20);
        System.out.println(u.getAge());



        Class<?> UU=Class.forName("jaran.Tomxk.reflect.User");
        Object o = UU.newInstance();

        Method setName = UU.getMethod("setName", String.class);
        setName.invoke(o,"tomsd");

        Method getAge = UU.getMethod("getName");
        Object result = getAge.invoke(o);
        System.out.println(result);



    }
}
